//import verify rules package 
const joi=require('joi')
//define verify rules
const password =joi.string().pattern(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/).required()
const email=joi.string().email().required()
const id=joi.number().integer().min(1).required()
const username=joi.string().min(1).required()
const hiredate=joi.date().required()
const tel=joi.string().pattern(/^(13[0-9]|14[01456879]|15[0-3,5-9]|16[2567]|17[0-8]|18[0-9]|19[0-3,5-9])\d{8}$/).required()
const card=joi.string().pattern(/^([1-9]{1})(\d{15}|\d{16}|\d{18})$/).required()
const idc=joi.string().pattern(/^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9xX]$/).required()
const code=joi.string().max(6).min(6).required()
const address=joi.string().required()
const selecttype=joi.string().required()
const inputtext=joi.required()
const start_date=joi.required()
const end_date=joi.required()
//define login&resetpassword form verify rules object

exports.custsup_find={
    body:{
        selecttype,
        inputtext,
    },
}
exports.docoper_find={
    body:{
        selecttype,
        inputtext,
        start_date,
        end_date,
    },
}

exports.login_schema={
    body:{
        email,
        password,
        code,
    },
}
exports.cust_schema={
    body:{
        username,
        password,
        email,
        idc,
        card,
    },
}

exports.cust_update_schema={
    body:{
        id,
        username,
        email,
        idc,
        card,
    },
}

exports.delete_schema={
    body:{
        id,
    },
}



exports.docoper_schema={
    body:{
        username,
        password,
        email,
        tel,
        hiredate,
    },
}

exports.docoper_update_schema={
    body:{
        id,
        username,
        email,
        tel,
        hiredate,
    },
}

exports.sup_schema={
    body:{
        username,
        address,
        tel,
    },
}



exports.sup_update_schema={
    body:{
        id,
        username,
        address,
        tel,
    },
}


exports.schema={
    body:{
        email,
    },
}

exports.reset_schema={
    body:{
        id,
        password,
    },
}